home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / xms206.arc / TESTS.ARC / HITEST.ASM < prev    next >
Assembly Source File  |  1989-04-04  |  8KB  |  269 lines

  1. ;****************************************************************************
  2. ;*                                                                          *
  3. ;*  HITEST.ASM -                                            Chip Anderson   *
  4. ;*                                                                          *
  5. ;*      DOS XMS Driver Testing Program                                      *
  6. ;*                                                                          *
  7. ;*      Used to verify the functionality of any DOS XMS Driver.             *
  8. ;*                                                                          *
  9. ;****************************************************************************
  10.  
  11.         name    Test
  12.         title   'DOS XMS Test Program'
  13.  
  14. code    segment byte public 'CODE'
  15.  
  16.         assume  cs:code, ds:code, es:code
  17.  
  18.         org     100h
  19.  
  20. main    proc    near
  21.  
  22.         mov     ah,9h
  23.         mov     dx,offset SignOn
  24.         int     21h
  25.  
  26.         ; Is an XMS Driver installed?
  27.         mov     ax,4300h
  28.         int     2Fh
  29.         cmp     al,80h
  30.         je      HMMIn
  31.         mov     ah,9h
  32.         mov     dx,offset AintThere
  33.         int     21h
  34.         int     20h                     ; Terminate
  35.  
  36. HMMIn:  mov     ah,9h
  37.         mov     dx,offset FoundOne
  38.         int     21h
  39.  
  40.         ; Get the HMM's control entry point
  41.         mov     ax,4310h
  42.         int     2Fh
  43.         mov     word ptr cs:[HMMEntryPt][0],bx
  44.         mov     word ptr cs:[HMMEntryPt][2],es
  45.  
  46.         ; Get the HMM's version number
  47.         mov     ax,0
  48.         call    cs:[HMMEntryPt]
  49.         
  50.         push    bx                      ; Save driver internal number
  51.         call    PrintAX
  52.         
  53.         mov     ah,9h
  54.         mov     dx,offset InternalVer
  55.         int     21h        
  56.         
  57.         pop     ax                      ; Restore driver internal number
  58.         
  59.         call    PrintAX
  60.  
  61.         
  62.         ;*------------------------------------------------------------------*
  63.         ;*      Basic Function Check                                        *
  64.         ;*------------------------------------------------------------------*
  65.  
  66. StartTesting:
  67.         xor     bx,bx
  68.         push    cs
  69.         pop     es
  70.         mov     si,offset rgbCommands
  71. cloop:  mov     bl,byte ptr es:[si]
  72.         cmp     bl,'$'
  73.         je      exit
  74.  
  75.         ; Print the command being executed
  76.         mov     ch,bl
  77.         shl     bx,1
  78.         mov     dx,[rgszCommands+bx]
  79.         mov     ah,9h
  80.         int     21h
  81.  
  82.         cmp     ch,cmdDivider
  83.         je      isnop
  84.         
  85.         push    bx
  86.     mov    ah,ch
  87.     mov    dx,8192
  88.         call    cs:[HMMEntryPt]
  89.         pop     bx
  90.  
  91.         ; Print the result
  92.         or      ax,ax
  93.         jz      Fail
  94.         mov     dx,offset Success
  95.         jmp     short PrintIt
  96. Fail:   mov     dx,offset Failure
  97. PrintIt:mov     ah,9
  98.         int     21h
  99.  
  100.         ; Now print the state of the A20 Line
  101.         mov     dx,offset A20Msg
  102.         int     21h
  103.         mov     ah,7h
  104.         call    cs:[HMMEntryPt]
  105.         or      ax,ax
  106.         jz      NoA20
  107.         mov     dx,offset A20On
  108.         jmp     short PrntIt2
  109. NoA20:  mov     dx,offset A20Off
  110. PrntIt2:mov     ah,9h
  111.         int     21h
  112.  
  113. isnop:  inc     si
  114.         jmp     cloop
  115.  
  116. exit:   ; Now do the extended memory test
  117.         mov     dx,[rgszCommands+16]
  118.         mov     ah,9h
  119.         int     21h
  120.         mov     ah,08h
  121.         call    cs:[HMMEntryPt]
  122.         call    PrintAX
  123.         
  124.         ; Allocate alot of stuff
  125.         mov     dx,[rgszCommands+18]
  126.         mov     ah,9h
  127.         int     21h
  128.         mov     dx,100h
  129.         mov     ah,09h
  130.         call    cs:[HMMEntryPt]
  131.         push    dx
  132.         push    dx    
  133.         call    PrintAX
  134.         pop     ax
  135.         call    PrintAX
  136.                 
  137.         mov     dx,[rgszCommands+16]
  138.         mov     ah,9h
  139.         int     21h
  140.         mov     ah,08h
  141.         call    cs:[HMMEntryPt]
  142.         call    PrintAX
  143.         
  144.         mov     dx,[rgszCommands+20]
  145.         mov     ah,9h
  146.         int     21h
  147.         pop     dx
  148.         mov     ah,10
  149.         call    cs:[HMMEntryPt]
  150.         call    PrintAX
  151.         
  152.         mov     dx,[rgszCommands+16]
  153.         mov     ah,9h
  154.         int     21h
  155.         mov     ah,08h
  156.         call    cs:[HMMEntryPt]
  157.         call    PrintAX
  158.         
  159.         ret
  160.  
  161. main    endp
  162.  
  163.  
  164. PrintAX proc    near
  165.         ; Print it
  166.         mov     bx,ax
  167.         mov     ch,4
  168. HexLoop:mov     cl,4
  169.         rol     bx,cl
  170.         mov     al,bl
  171.         and     al,0Fh
  172.         add     al,30h
  173.         cmp     al,3Ah
  174.         jl      Output
  175.         add     al,07h
  176. Output: mov     dl,al
  177.         mov     ah,02h
  178.         int     21h
  179.         dec     ch
  180.         jnz     HexLoop
  181.         ret
  182.         
  183. PrintAX endp
  184.  
  185. ;*--------------------------------------------------------------------------*
  186. ;*      Data Area                                                           *
  187. ;*--------------------------------------------------------------------------*
  188.  
  189. cmdVersion  equ     0
  190. cmdRequest  equ     1
  191. cmdRelease  equ     2
  192. cmdGEnable  equ     3
  193. cmdGDisable equ     4
  194. cmdTEnable  equ     5
  195. cmdTDisable equ     6
  196. cmdA20Query equ     7
  197. cmdExtQuery equ     8
  198. cmdExtAlloc equ     9
  199. cmdExtFree  equ     10
  200. cmdDivider  equ     11
  201.  
  202. rgbCommands db      cmdDivider
  203.  
  204.             ; Normal High Memory Area Test
  205.             db      cmdRequest, cmdRelease, cmdDivider
  206.  
  207.             ; Nested High Memory Area Test
  208.             db      cmdRequest, cmdRequest, cmdRelease, cmdRelease, cmdDivider
  209.             db      cmdDivider
  210.  
  211.         ; Global vs Local A20 Test
  212.         db        cmdGEnable
  213.         db        cmdTEnable, cmdTDisable
  214.         db        cmdGDisable, cmdDivider
  215.  
  216.         ; Local vs Global A20 Test
  217.         db        cmdTEnable
  218.         db        cmdGEnable, cmdGDisable
  219.         db        cmdTDisable, cmdDivider
  220.  
  221.             db      '$'
  222.  
  223. rgszCommands dw     szVer
  224.             dw      szHighReq
  225.             dw      szHighRel
  226.             dw      szGEnable
  227.             dw      szGDisable
  228.             dw      szTEnable
  229.             dw      szTDisable
  230.             dw      szTestA20
  231.             dw      szExtQuery
  232.             dw      szExtAlloc
  233.             dw      szExtFree
  234.             dw      szDivider
  235.  
  236. szVer       db      13,10,'Version: $'
  237. szHighReq   db      13,10,'Request High Memory Area:  $'
  238. szHighRel   db      13,10,'Release High Memory Area:  $'
  239. szGEnable   db      13,10,'Globally Enable A20 Line:  $'
  240. szGDisable  db      13,10,'Globally Disable A20 Line: $'
  241. szTEnable   db      13,10,'Temp. Enable A20 Line:     $'
  242. szTDisable  db      13,10,'Temp. Disable A20 Line:    $'
  243. szTestA20   db      13,10,'See if the A20 Line is On: $'
  244. szExtQuery  db      13,10,'Extended Memory Free:      $'
  245. szExtAlloc  db      13,10,'Allocating 100K:           $'
  246. szExtFree   db      13,10,'Freeing it:                $'
  247. szDivider   db      13,10,'------------------------------------------------------$'
  248.  
  249. Success     db      'Succeeded$'
  250. Failure     db      'Failed   $'
  251.  
  252. A20Msg      db      ' - A20 Line is $'
  253. A20On       db      'On$'
  254. A20Off      db      'Off$'
  255.  
  256. SignOn      db      13,10,'High Memory Manager Test Program 2.0 - 7/05/88'
  257.             db      13,10,'Copyright 1988, Microsoft Corp.'
  258.             db      13,10,'$'
  259.  
  260. FoundOne    db      13,10,'High Memory Manager is Installed - Version $'
  261. InternalVer db      13,10,'                                   Internal Version $'
  262. AintThere   db      13,10,'High Memory Manager not Installed.$'
  263.  
  264. HMMEntryPt  dd      ?
  265.  
  266. code    ends
  267.  
  268.         end     main
  269.